package com.aphrodite.ui.widgets.barcode;

/**
 * Specific implementation of Module that draws a blank bar (of configurable
 * width). This can be used to insert inter-module spaces (as required by some
 * barcode formats) without having to modify the data to be encoded to include
 * the spaces. <p/>Note: You should not instantiate this class directly.
 */
class SeparatorModule extends Module {

	/**
	 * Constructs a new SeparatorModule with a width of 1.
	 */
	SeparatorModule() {
		super(new int[] { 1 });
	}

	/**
	 * Constructs a new SeparatorModule with the specified width.
	 * 
	 * @param width
	 *            The width of the separator in bar widths.
	 */
	SeparatorModule(int width) {
		super(new int[] { width });
	}

	/**
	 * Draws the module to the specified output.
	 * 
	 * @param output
	 *            The barcode output to draw to
	 * @param x
	 *            The starting X co-ordinate
	 * @param y
	 *            The starting Y co-ordinate
	 * @param barWidth
	 * @param barHeight
	 * @return The total width drawn
	 */
	protected int draw(Output output, int x, int y, int barWidth, int barHeight) throws OutputException {
		int w = bars[0] * barWidth;
		output.drawBar(x, y, w, barHeight, false);
		return w;
	}

	/**
	 * Returns the symbol that this module encodes.
	 * 
	 * @return A blank string
	 */
	String getSymbol() {
		return "";
	}
}
